package route

import (
	"core/remote/node"
	"core/repository"
	"core/service"
	"game/handler"
	"game/logic"
)

func Handlers() node.LogicHandler {
	// 创建 UserHandler
	userService := service.NewUserService(repository.New())
	um := logic.NewUnionManager()
	unionHandler := handler.NewUnionHandler(userService, um)
	gameHandler := handler.NewGameHandler(userService, um)
	// 创建 LogicHandler
	handlers := make(node.LogicHandler)
	handlers["unionHandler.createRoom"] = unionHandler.CreateRoom
	handlers["unionHandler.joinRoom"] = unionHandler.JoinRoom
	handlers["gameHandler.roomMessageNotify"] = gameHandler.RoomMessageNotify
	handlers["gameHandler.gameMessageNotify"] = gameHandler.GameMessageNotify
	return handlers
}
